Imports Microsoft.Xna.Framework

Public Class Position
	Public _screenRealSize As Vector2
	Public _spriteRealSize As Vector2
	Private _vector2 As Vector2



	Public Sub New(screenRealSize As Vector2, spriteRealSize As Vector2)
		_screenRealSize = screenRealSize
		_spriteRealSize = spriteRealSize
		_vector2 = Vector2.Zero
	End Sub

	''' <summary>
	''' The DrawValue is differtent coordinate position because the drawing routing
	''' draw sprite on the left upper corner and the real screen room screen begin to BOTTOM_BORDER
	''' 
	''' </summary>
	''' <returns></returns>

	'public Vector2 DrawValue()
	'{ return new Vector2(_vector2.X, _vector2.Y); }




	Public Property Value() As Vector2
		Get
			Return _vector2
		End Get
		Set
			_vector2 = value
		End Set
	End Property




	'mask X and Y values of Vector2 structure 
	Public Property X() As Single
		Get
			Return _vector2.X
		End Get
		Set
			_vector2.X = value
		End Set
	End Property


	Public Property Y() As Single
		Get

			Return _vector2.Y
		End Get
		Set
			_vector2.Y = value
		End Set
	End Property

	Public Function CheckCollision(p As Position) As Boolean
		If p.Y = Y Then
			If p.X + 10 > X And p.X - 10 < X Then
				Return True
			End If
		End If
		Return False
	End Function


	Public Function CheckOnRow(p As Position) As Boolean
		If p.Y = Y Then
			Return True
		End If
		Return False

	End Function

	Public Function CheckOnRowDistancePixel(p As Position) As Single
		If p.Y = Y Then
			Dim distance As Single = Math.Abs(p.X - X)
			'int ret = ((int)distance) / Tile.WIDTH;
			Return distance
		End If
		Return -1

	End Function


	Public Function CheckOnRowDistance(p As Position) As Single
		If p.Y = Y Then
			Dim distance As Single = Math.Abs(p.X - X)
			Dim ret As Integer = CInt(Math.Truncate(distance)) \ Tile.WIDTH
			Return ret
		End If
		Return -1

	End Function

	'53 pix total
	Public ReadOnly Property Bounding() As Rectangle
		Get
				'return new Rectangle((int)_vector2.X + Player.PLAYER_STAND_BORDER_FRAME, (int)_vector2.Y, (int)Player.PLAYER_STAND_FRAME, (int)_spriteRealSize.Y);
			Return New Rectangle(CInt(Math.Truncate(_vector2.X)), CInt(Math.Truncate(_vector2.Y)), CInt(Math.Truncate(_spriteRealSize.X)), CInt(Math.Truncate(_spriteRealSize.Y)))
		End Get
	End Property






	'''/example to mask a method of Vector2 structure 
	'public static float Dot(Position value1, Position value2)
	'{
	'    return Vector2.Dot(value1, value2);
	'}

	'''/override the cast to Vector2
	'public static implicit operator Vector2(Position value) 
	'{
	'    return new Vector2(value.X, value.Y);
	'}

End Class
